import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.JScrollBar;
import javax.swing.JList;
import java.util.HashSet;
import java.util.Collection;


public class VueConsultParution extends Vue {
	private JPanel contentPane;
	private JButton buttonFermer;
	private JButton btnConsulter;
	
	DefaultListModel mo = new DefaultListModel();
	private JList ListArticles = new  JList(mo);
	/**
	 * Create the frame from search.
	 */
	

	
	/**
	 * Create the frame from menu.
	 * @wbp.parser.constructor
	 */
	
	public VueConsultParution(Controleur controleur,Parution par) {
		super(controleur);
		setTitle("Informations sur un periodique");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 630, 475);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		buttonFermer = new JButton("Fermer");
		buttonFermer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().fermerVue(VueConsultParution.this);
			}
		});
		buttonFermer.setBounds(197, 346, 107, 25);
		contentPane.add(buttonFermer);
		Collection<Article> a=par.get_article().values();
		JLabel lblArticles = new JLabel("Articles");
		lblArticles.setBounds(75, 190, 61, 15);
		contentPane.add(lblArticles);
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		scrollPane.setBounds(196, 102, 345, 202);
		contentPane.add(scrollPane);
		scrollPane.setViewportView(ListArticles);
		
		for(Article ar : a)
		{
			mo.addElement(ar.get_titre());
		}
		ListArticles.setModel(mo);
		
		
	}


}
